package com.wwj.study.interview.chapter4;

import java.io.Serializable;
import java.lang.ref.SoftReference;
import java.lang.ref.WeakReference;

public class ReferenceDemo implements Serializable {


    public static void main(String[] args) {
        Object o = new Object();

        SoftReference softReference = new SoftReference(o);
        o=null;
        System.gc();
        System.out.println(softReference);

//        WeakReference weakReference=new WeakReference(o);
//        o=null;
//        System.gc();
//        System.out.println(weakReference.get());
    }
}
